/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hirt;

import java.awt.Point;

/**
 *
 * @author zmiller
 */
public class ToByte
{

    /*public static byte intToByte(int integer)
    {
        byte content = (byte)integer;
        return content;
    }

    public static byte[] stringToByte(String string)
    {
        return string.getBytes();
    }

    public static byte doubleToByte(double Double)
    {
        byte content = (byte)Double;
        return content;
    }

    public static byte itemToByte(Item item)
    {
        if (item == null)
        {
            return 0;
        }
        else
        {
            return (byte)item.getId();
        }
    }

    public static byte[] actionToByte(Action action)
    {
        byte[] buf = new byte[3];
        if (action.getActor() != null)
            buf[0] = intToByte(action.getActor().getId());
        else
            buf[0] = 0;
        buf[1] = doubleToByte(action.getStartTime());
        buf[2] = doubleToByte(action.getDurationTime());
        return buf;

    }
    
    public static byte[] communicationActionToByte(CommunicationAction action)
    {
        
        byte[] tmp = actionToByte(action);
        byte[] str = new byte[256];
        str = stringToByte(action.getMessage());
        byte[] buf = append(tmp, str);
        return buf;
    }

    public static byte[] pointToByte(Point point)
    {
        byte[] buf = new byte[8];
        for (int i = 3; )

    }
    
    public static byte[] append(byte[] bit1,byte[] bit2)
    {
	byte[] buf = new byte[bit1.length+bit2.length];
	int i;
	for(i=0; i<bit1.length;i++)
	{
		buf[i] = bit1[i];
	}
	for(int j = 0; j < bit2.length; j++)
	{
		buf[j+i] = bit2[j];
	}
	return buf;
    }*/
}
